package com.byxy.dao.impl;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.byxy.dao.SorderDao;
import com.byxy.dao.core.impl.BaseDaoImpl;
import com.byxy.entity.Forder;
import com.byxy.entity.Product;
import com.byxy.entity.Sorder;
import com.byxy.entity.User;

@Repository
public class SorderDaoImpl extends BaseDaoImpl<Sorder> implements SorderDao {

	@Override
	public void select(String sorder, String product) {

	}

	@Override
	public Sorder getByProductAndForder(Product product, Forder forder) {
		String hql = "from Sorder s where s.product =:product and s.forder =:forder";
		List<Sorder> ss = sessionFactory.getCurrentSession().createQuery(hql).setParameter("product", product)
				.setParameter("forder", forder).list();
		if (ss.size() > 0)
			return ss.get(0);
		else
			return null;
	}

}